package com.cbgolf.oa.activity.bill;

import android.os.Bundle;
import android.support.annotation.Nullable;

import com.cbgolf.oa.R;
import com.cbgolf.oa.activity.order.OrderDetails;
import com.cbgolf.oa.base.BaseActivity;
import com.cbgolf.oa.model.BillHistoryModel;
import com.cbgolf.oa.presenter.IBillPresenter;
import com.cbgolf.oa.util.EnumUtil;
import com.cbgolf.oa.views.BillHistoryView;

/**
 * @author Created by lq on 2017/11/2.
 */

public class BillHistory extends BaseActivity implements IBillPresenter {

  private BillHistoryView view;
  private BillHistoryModel model;


  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.a_billhistory);
  }

  @Override
  protected void findViews() {
    view = new BillHistoryView(this, this);
    model = new BillHistoryModel(this, this);

  }

  @Override
  public String getActivityTitle() {
    return "开单历史";
  }

  @Override
  public void back() {
    finish();
  }

  @Override
  public void showProgress() {
    view.showProgress();
  }

  @Override
  public void stopProgress() {
    view.stopProgress();
  }

  @Override
  public void getDataFail(String msg) {
    view.getDataFail(msg);
  }

  @Override
  public void getDataSuccess(Object obj) {
    view.getDataSuccess(obj);
  }

  @Override
  public void refershFail(String msg, int code) {

  }

  @Override
  public void refershSuccess(Object obj) {
    view.getDataSuccess(obj);
  }

  @Override
  public void loadMoreFail(String msg, int code) {

  }

  @Override
  public void loadMoreSuccess(Object obj) {
    view.showLoadMore(obj);
  }

  @Override
  public void refresh() {
    model.getData(EnumUtil.REFRESH);
  }

  @Override
  public void reLoad() {
    model.getData(EnumUtil.INITDATA);
  }

  @Override
  public void showDetails(String orderId) {
    mStartActivity(OrderDetails.class, "id", orderId);
  }


  @Override
  public void loadMore() {
    model.getData(EnumUtil.LOADMORE);
  }

  @Override
  public void getDataFail(String msg, int code) {
    view.getDataFail(msg, code);
  }
}
